package com.djakapm.markdown.editor.action;

import com.djakapm.markdown.editor.AppConstant;
import com.djakapm.markdown.editor.Application;
import com.djakapm.markdown.editor.util.ResourceManager;

import javax.swing.*;
import java.awt.event.ActionEvent;

public class ExitApplicationAction extends AbstractAction {
    private Application app;

    public ExitApplicationAction(Application app){
        this.app = app;
        this.putValue(Action.NAME, AppConstant.EXIT_LABEL);
        this.putValue(Action.SMALL_ICON, ResourceManager.getIcon(AppConstant.EXIT_ICON_NAME));
    }
    
    public void actionPerformed(ActionEvent e) {
        this.app.exit();
    }
}
